package com.startit.validation;

import com.startit.csv.CSVField.ValidationType;
import com.startit.util.StringUtil;

public class MaxValidation implements IValidation {
	public static final ValidationType name = ValidationType.MAX;

	private int max;

	public MaxValidation(int max) {
		super();
		this.max = max;
	}

	public boolean valid(String v) {
		try {
			return StringUtil.isEmpty(v) || max >= (new Integer(v)).intValue();
		} catch (NumberFormatException e) {
			return false;
		}
	}

}
